package com.hongyue.dey07;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.rmi.server.UID;
import java.util.UUID;

public class fuwuqi {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(9527);
        Socket a = ss.accept();
        InputStream is = a.getInputStream();
        InetAddress ia = a.getInetAddress();
        System.out.println(ia.getAddress());
        System.out.println(ia.getHostName());
        FileOutputStream fos = new FileOutputStream("C:\\Users\\86182\\Desktop\\1.zip");
        byte[] bys = new byte[1024*8];
        for (int i; (i = is.read(bys)) != -1; ) {
            fos.write(bys, 0, i);
        }
        OutputStream os = a.getOutputStream();
        os.write("接受文件成功".getBytes());
    }
}
